# 执法专题 首页
from Lib.base.keywords import KeyWords
from selenium.webdriver.common.by import By
from Lib.common.common_function import *
from Lib.base.page_object.login_page import LonginPage
import uuid
import random


class Home(KeyWords):
    url = KeyWords.url + 'safety-production/home'

    def search_enterprise_detail(self):
        '''
        搜索企业并查看企业详情
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\safety_production\home\enterprise_search_and_detail.yaml')
        element_operation(self, data[0]['data'])

    def search_enterprise_and_event(self):
        '''
        搜索企业并查看违法事件列表
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\safety_production\home\enterprise_search_and_event.yaml')
        element_operation(self, data[0]['data'])

    def search_enterprise_and_task(self):
        '''
        搜索企业并查看执法任务列表
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\safety_production\home\enterprise_search_and_task.yaml')
        element_operation(self, data[0]['data'])

    def search_event_detail(self):
        '''
        搜事件并查看详情
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\safety_production\home\event_search_and_detail.yaml')
        element_operation(self, data[0]['data'])

    def search_event_list(self):
        '''
        搜事件查看违法事件列表
        :return:
        '''
        data = get_data_by_yaml(
            get_path() + r'\Data\element_data\safety_production\home\event_search_and_list.yaml')
        element_operation(self, data[0]['data'])


if __name__ == '__main__':
    driver = choose_browser()
    L = LonginPage(driver)
    L.login('kobekq1', 'kobe8888')
    case = Home(driver)
    case.search_event_list()
    driver.quit()
